//index.js
//获取应用实例
var app = getApp()
Page({

  data: {
    imgUrls: [
      '../../p1.jpg',
      '../../p2.jpg',
      '../../p3.jpg'
    ],
    indicatorDots: true,
    autoplay: true,
    interval: 3000,
    duration: 1000,
    navItems:[
      {
        name:'堂食',
        url:'dishes'
      },
      {
        name:'食堂报名名单',
        url:'manager',
        isSplot:true
      },
      {
        name:'副食领取',
        url:'subfood'
      },
      {
        name:'投票',
        url:'bill'
      },
      {
        name:'帐单',
        url:'subfoodorderlist',
        isSplot:true
      },
      {
        name:'管理',
        url:'admin'
      }
    ]
  },
  onLoad: function () {
    var app=getApp()
    console.log('onLoad')
    if (app.globalData.goRe){
    wx.request({
      url: 'https://thtl.vip/jishu/doLogin',
      data: {
        openId: app.globalData.mopenId
      },
      success: function (res) {
        console.log(res.data)
        if (res.data =='') {
          console.log('去注册')
          setTimeout(function () {
            wx.navigateTo({
              url: "../../pages/components/register/register"
            })
          }, 1)

        } else {
          console.log('不去注册')
          wx.navigateTo({
            url: "../../../pages/index/index/"
          })
        }
      }
    })
  }
  }
    
})
